package org.tong.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Lazy;
import org.tong.bean.FirstBean;
import org.tong.bean.SecondBean;
import org.tong.bean.Student;

@Configuration
public class InnitConfig {

    @Bean
    public Student initStudent() {
        Student student = new Student();
        student.setName("小红");
        return student;
    }

    @Bean
    @Lazy
    @DependsOn({"secondBean"})
    public FirstBean initFirstBean() {
        return new FirstBean();
    }

    @Bean(name = "secondBean")
    @Lazy
    public SecondBean initSecondBean() {
        return new SecondBean();
    }
}
